Custom Ticks
Custom ticks allow highly customizable tick markers to be added to an axis. They support styles, labels, positioning, and more. This includes 2D and 3D variants.
Creating a Custom Tick
tick = axis.add_custom_tick('major') # 'minor' or 'box' also valid
tick.set_value(100).set_text("Milestone")
CustomTick (2D)
Positioning & Text
tick.set_value(100) # Position on axis
tick.set_text("Checkpoint A") # Label text
tick.set_decimal_precision(2) # Decimal formatting
Axis Behavior
tick.set_allocates_axis_space(False) # Prevents auto resizing of axis for this tick
Grid Stroke Styling
tick.set_grid_stroke_length(60) # Percentage length
tick.set_grid_stroke_style(thickness=2, color='#ff8800')
Marker Appearance
tick.set_marker_color('#00aaff') # Label color
tick.set_marker_font(size=14, style='italic', weight='bold')
tick.set_marker_visible(True)
Label Layout
tick.set_tick_label_padding(5) # Gap between line and label
tick.set_tick_label_rotation(45) # Rotate label
tick.set_tick_length(10) # Tick line size in pixels
Label Alignment
# Align label relative to the tick line
# -1: after tick line, 0: centered on tick, +1: before tick line
tick.set_tick_label_alignment(-1)
# Center label on the tick line
tick.set_tick_label_alignment(0)
# XY axes: control secondary alignment (perpendicular dimension)
tick.set_tick_label_alignment(alignment=-1, alignment2=0.5)
CustomTick3D (3D)
Setup
tick3d = axis.add_custom_tick('box')
tick3d.set_value(300).set_text("Event Zone")
Background Styling
tick3d.set_background_color('#333333')
tick3d.set_background_stroke(thickness=1, color='white')
Tick Line Appearance
tick3d.set_tick_style(thickness=2, color='#ff0000')
tick3d.set_tick_length(6)
tick3d.set_grid_stroke(thickness=1, color='gray')
Text Styling
tick3d.set_text_color('white')
tick3d.set_text_font(size=12, style='italic')
Padding (Box Labels)
tick3d.set_padding(5) # Uniform
tick3d.set_padding(left=8, top=4, right=8, bottom=4) # Custom sides